<template>
    <div>
        <div>hello a</div>
        <button @click="addrouter">添加查看c组件的权限</button>
        <router-link to ="/c">申请权限后点击跳转至c</router-link>
    </div>
</template>

<script>
    import C from './c'
    export default {
        // name: "a",
        methods:{
            //动态装载路由，也可以在此添加局部路由守卫
            //局部路由守卫：beforeRouteEnter，beforeRouteUpdate，beforeRouteLeave 这三个钩子
            addrouter(){
                this.$router.addRoutes(
                    [
                        {path:'/c',component:C,}
                    ]
                )
            }
        }
    }
</script>

<style scoped>

</style>